<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <input type="text" placeholder="姓名" v-model="emp.name">
    <input type="text" placeholder="薪资" v-model="emp.salary">
    <input type="text" placeholder="岗位" v-model="emp.job">
    <button @click="f()">提交</button>
   <table border="1px">
       <tr>
           <th>编号</th>
           <th>姓名</th>
           <th>薪资</th>
           <th>岗位</th>
           <th>操作</th>
       </tr>
       <tr v-for="(emp,i) in arr" :key="i">
           <td>{{i+1}}</td>
           <td>{{emp.name}}</td>
           <td>{{emp.salary}}</td>
           <td>{{emp.job}}</td>
           <td><button @click="remove(i)">删除</button></td>
       </tr>
   </table>
</div>
<script src="../js/vue.js"></script>
<script>
    let v = new Vue({
        el:"body>div",
        data() {
            return {
                arr: [{name:"张三",salary:4000,job:"销售"},
                    {name:"李四",salary:3000,job:"财务"},
                    {name:"王五",salary:3500,job:"会计"}],
                emp:{name:"",salary:"",job:""}
            }
        },
        methods: {
            f() {
              v.arr.push({name:v.emp.name,salary:v.emp.salary,job:v.emp.job})
            },
            remove(i){
                v.arr.splice(i,1)
            }
        },
    })
</script>
</body>
</html>